package utils

import "context"

type TraceId string

type traceIdKey struct {
}

func WithExtraTraceId(ctx context.Context, traceId TraceId) context.Context {
	return context.WithValue(ctx, traceIdKey{}, traceId)
}

func ExtraTraceId(ctx context.Context) (TraceId, bool) {
	r, ok := ctx.Value(traceIdKey{}).(TraceId)
	return r, ok
}

type RequestId string

type requestIdKey struct {
}

func WithExtraRequestId(ctx context.Context, requestId RequestId) context.Context {
	return context.WithValue(ctx, requestIdKey{}, requestId)
}

func ExtraRequestId(ctx context.Context) (RequestId, bool) {
	r, ok := ctx.Value(requestIdKey{}).(RequestId)
	return r, ok
}
